module.exports = function(window, document) {
	var apivm = require('../../common/avm.min')(window, document);
	var avm = apivm;
	var api = apivm.api;
	var Component = apivm.Component;
	var $ = apivm.$;
	(function() {
	var Storage = /*@__PURE__*/ (function(Component) {
		function Storage(props) {
			Component.call(this, props);
			this.data = {
				user: {
					name: "老王",
					age: 30
				}
			};
		}

		if (Component) Storage.__proto__ = Component;
		Storage.prototype = Object.create(Component && Component.prototype);
		Storage.prototype.constructor = Storage;
		Storage.prototype.apiready = function() {
			//like created
			if (localStorage) {
				localStorage.getItem("user") &&
					(this.data.user = JSON.parse(localStorage.getItem("user")));
			} else {
				wx.getStorageSync("user") &&
					(this.data.user = JSON.parse(wx.getStorageSync("user")));
			}
		};
		Storage.prototype.saveFn = function() {
			if (localStorage) {
				localStorage.setItem("user", JSON.stringify(this.data.user));
			} else {
				wx.setStorageSync("user", JSON.stringify(this.data.user));
			}
		};
		Storage.prototype.render = function() {
			var this$1 = this;
			return apivm.h(
				"view",
				{class: "page"},
				apivm.h(
					"button",
					{
						onclick: function(event) {
							if (this$1.saveFn) {
								this$1.saveFn(event);
							} else {
								saveFn(event);
							}
						}
					},
					"保存数据到storage"
				),
				apivm.h("view", null, this.data.user.name)
			);
		};

		return Storage;
	})(Component);
	apivm.define("storage", Storage);
	apivm.render(apivm.h("storage", null), "body");
})();

	window['createApp'] = function() {
		apivm.$_start();
	}
	return avm;
}